﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using System.Configuration;
using System.Web.Mvc;
namespace RBAC.Web.Models
{
    public class RoleModel : BaseModel
    {

        //Autokey NOT PK
        [DisplayName("Id")]
        public int Id { get; set; }

        //Pk NOT Autokey
        [Required]
        [StringLength(255, ErrorMessage = "RoleCode cannot be longer than 255 characters.")]
        [Remote("doesRoleCodeExist", "Role", HttpMethod = "POST", AdditionalFields = "Mode, OldValue", ErrorMessage = "Role Code already exists. Please enter a different Role Code")]
        [DisplayName("Role Code")]
        public String RoleCode { get; set; }


        [Required]
        [StringLength(255, ErrorMessage = "RoleName cannot be longer than 255 characters.")]
        [DisplayName("Role Name")]
        public String RoleName { get; set; }


        [Required]
        [StringLength(255, ErrorMessage = "Description cannot be longer than 255 characters.")]
        [DisplayName("Description")]
        public String Description { get; set; }


        //[Required]
        //[DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)]
        //[DisplayName("Create Date")]
        //public DateTime CreateDate { get; set; }


        [Required(ErrorMessage = "Please select RoleStatus")]
        [DisplayName("Status")]
        public int RoleStatus { get; set; }


        /*Master Detail*/
        public List<PermissionModel> Permissions { get; set; }

        // For PopLookup
        public List<RoleModel> ListOfRole { get; set; }
        public string[] RequiredFields { get; set; }
    }
}